<?
function datemysql($day=''){
	return strftime("%Y-%m-%d", strtotime($day));
} 
function datevn2mysql($day=''){
	$data = explode("/", $day) ;
	return $data[2]."-".$data[1]."-".$data[0];
}
function dateus2mysql($day=''){
	$data = explode("/", $day) ;
	return $data[2]."-".$data[0]."-".$data[1];
}
function datevn($day='', $dot='.'){
	if(empty($day)) return '';
	return strftime("%d$dot%m$dot%Y", strtotime($day));
} 
function disdate($d1,$d2){
    //date yyyy-mm-dd
    $ar = explode("-",$d1) ;
    $br = explode("-",$d2) ;
   
    $a = mktime(0,0,0,intval($ar[1]),intval($ar[2]),intval($ar[0])) ;
    $b = mktime(0,0,0,intval($br[1]),intval($br[2]),intval($br[0])) ;
   
    $c = $b - $a ;
    $e = $c / (24 * 60 * 60) ;
   
    return $e ;
}

function countdate($date, $str)
{
	$date = new DateTime($date);
	$date->modify($str);
	return $date->format('Y-m-d');

}
?>